angular.module("driver").controller("TradesCtrl", ['$scope', '$meteor',
  '$rootScope', '$state', '$ionicPopup', 'Map',
  function($scope, $meteor, $rootScope, $state, $ionicPopup, Map,  $timeout, $ionicFrostedDelegate, $ionicScrollDelegate) {

  	$scope.request = function () {
      if (!Meteor.user()) {
            //throw new Meteor.Error("未登录！", "必须先登录！");           
        var alertPopup = $ionicPopup.alert({
          title: '温馨提示',
          template: '请您先登录！',
          okType: 'button-royal',
          okText: '确定'
        });
        alertPopup.then(function(res) {
          $state.go('account');
        });
        return false;
      }
      
      //console.log(request[0]);

      var confirmPopup = $ionicPopup.confirm({
     title: '温馨提示',
     template: '线上交易功能暂未开放，敬请期待！',
     cancelText: '取消', 
     cancelType: 'button-royal button-outline',
     okText: '确定', 
     okType: 'button-assertive button-outline',
   });
      confirmPopup.then(function(res) {
     if(res) {
      $state.go('users');
     } else {
       //console.log('继续等待');
     }
   });
    };




  }
]);